home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9370 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What is the correct behaviour ?
  5. Date: 09 Mar 1996 21:56:52 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar9145652@qcd.lanl.gov>
  8. References: <1996Mar9.130223.1400@paramount.nikhefk.nikhef.nl>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: bouvere@paramount.nikhefk.nikhef.nl's message of Sat, 9 Mar 1996 13:02:23 GMT
  13.  
  14. In article <1996Mar9.130223.1400@paramount.nikhefk.nikhef.nl>
  15. bouvere@paramount.nikhefk.nikhef.nl (Ferdinand de Bouvere) writes:
  16.  
  17. FdB: Trying this code on 3 platforms:
  18. FdB: 
  19. FdB:     int a = 0;
  20. FdB:  
  21. FdB:     main()
  22. FdB:     {
  23. FdB:         int a = 123;
  24. FdB:         {
  25. FdB:             extern int a;
  26. FdB:             printf("%d\n", a);
  27. FdB:         }
  28. FdB:     }
  29. FdB: 
  30. FdB: HP/UX compiler: OK
  31. FdB: result: 0
  32.  
  33. The above is the correct behaviour under ANSI.
  34.  
  35. FdB: 
  36. FdB: Linux gcc: OK
  37. FdB: result: 123
  38. FdB: 
  39. FdB: SUN compiler (pre ansi): compile error:
  40. FdB:     "c.c", line 7: redeclaration of a
  41. FdB:     Compilation failed
  42. FdB: 
  43. FdB: So, what should be the correct behaviour ?
  44.  
  45. Cheers
  46. Tanmoy
  47. --
  48. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  49. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  50. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  51. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  52. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  53. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  54.